<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions">

	<h:panelGroup layout="block" styleClass="ui-corner-all card #{_item.styleClass}"
		rendered="#{not empty _item}">

		<h:graphicImage url="#{commonCtrl.sphereImagePath}#{fn:toLowerCase(_item.card.sphereCode)}.png"
			rendered="#{not empty _item.card.sphereCode and _item.card.sphereCode != 'NEUTRAL'}"
			styleClass="card-sphere-icon" />

		<h:graphicImage url="#{commonCtrl.encounterSetImagePath}#{_item.card.enstTechName}.png"
			rendered="#{not empty _item.card.enstTechName}"
			alt="#{msgs.encounterSet}:&nbsp;#{_item.card.enstName}"
			title="#{msgs.encounterSet}:&nbsp;#{_item.card.enstName}" styleClass="card-encset-icon" />

		<h:panelGroup styleClass="card-title" layout="block">

			<h:graphicImage url="#{commonCtrl.commonImagePath}unique_16x16.png" style="margin-bottom: -1px;"
				rendered="#{_item.card.unique}" />

			<h:outputText value="#{_item.card.name}&nbsp;" />
			<p:commandLink value="#{_item.card.typeDisplay}"
				action="#{cardSearchCtrl.searchWithType(_item.card.type)}"
				style="color: gray; font-weight: normal; font-style: italic; font-size: 0.8em;"
				styleClass="search-link" update=":searchForm:searchBox :searchResults" process="@this" />
			<!-- <h:outputText value="&nbsp;#{_item.card.typeDisplay}"
				style="color: gray; font-weight: normal; font-style: italic; font-size: 0.8em;" /> -->
		</h:panelGroup>

		<h:panelGroup styleClass="card-trait" layout="block" rendered="#{not empty _item.card.trait}">
			<!-- <h:outputText value="#{_item.card.trait}" /> -->
			<p:commandLink value="#{_item.traits[0]}" rendered="#{not empty _item.traits[0]}"
				action="#{cardSearchCtrl.searchWithTrait(_item.traits[0])}" styleClass="search-link"
				update=":searchForm:searchBox :searchResults" process="@this" />
			<h:outputText value="&nbsp;" rendered="#{not empty _item.traits[1]}" />
			<p:commandLink value="#{_item.traits[1]}" rendered="#{not empty _item.traits[1]}"
				action="#{cardSearchCtrl.searchWithTrait(_item.traits[1])}" styleClass="search-link"
				update=":searchForm:searchBox :searchResults" process="@this" />
			<h:outputText value="&nbsp;" rendered="#{not empty _item.traits[2]}" />
			<p:commandLink value="#{_item.traits[2]}" rendered="#{not empty _item.traits[2]}"
				action="#{cardSearchCtrl.searchWithTrait(_item.traits[2])}" styleClass="search-link"
				update=":searchForm:searchBox :searchResults" process="@this" />
		</h:panelGroup>

		<h:outputText value="#{_item.card.subName}" rendered="#{not empty _item.card.subName}" />

		<h:panelGroup styleClass="card-stats" layout="block">
			<p>
				<h:outputText value="#{_item.card.startingThreat}&nbsp;" styleClass="card-stat-starting-threat"
					rendered="#{not empty _item.card.startingThreat}" converter="cardStatConverter" />

				<h:outputText value="#{_item.card.engageThreat}&nbsp;" styleClass="card-stat-engage-threat"
					rendered="#{not empty _item.card.engageThreat}" converter="cardStatConverter" />

				<ui:fragment rendered="#{not empty _item.card.questPoints}">
					<h:outputText value="#{_item.card.questPoints}" styleClass="card-stat-quest-points"
						converter="cardStatConverter" />
					<h:outputText value="&nbsp;" />
				</ui:fragment>

				<ui:fragment rendered="#{not empty _item.card.cost}">
					<h:outputText value="#{_item.card.cost}" styleClass="card-stat-cost"
						converter="cardStatConverter" />
					<h:outputText value="&nbsp;" />
				</ui:fragment>

				<ui:fragment rendered="#{not empty _item.card.threat}">
					<h:outputText value="#{_item.card.threat}" converter="cardStatConverter" />
					<h:graphicImage url="#{commonCtrl.commonImagePath}threat_20x20.png" class="card-stat-icon" />
					<h:outputText value="&nbsp;" />
				</ui:fragment>

				<ui:fragment rendered="#{not empty _item.card.willpower}">
					<h:outputText value="#{_item.card.willpower}" converter="cardStatConverter" />
					<h:graphicImage url="#{commonCtrl.commonImagePath}willpower_20x20.png" class="card-stat-icon" />
					<h:outputText value="&nbsp;" />
				</ui:fragment>

				<ui:fragment rendered="#{not empty _item.card.attack}">
					<h:outputText value="#{_item.card.attack}" converter="cardStatConverter" />
					<h:graphicImage url="#{commonCtrl.commonImagePath}attack_20x20.png" class="card-stat-icon" />
					<h:outputText value="&nbsp;" />
				</ui:fragment>

				<ui:fragment rendered="#{not empty _item.card.defense}">
					<h:outputText value="#{_item.card.defense}" converter="cardStatConverter" />
					<h:graphicImage url="#{commonCtrl.commonImagePath}defense_20x20.png" class="card-stat-icon" />
					<h:outputText value="&nbsp;" />
				</ui:fragment>

				<h:outputText value="#{_item.card.hitPoints}" styleClass="card-stat-hit-points"
					rendered="#{not empty _item.card.hitPoints}" converter="cardStatConverter" />
			</p>
		</h:panelGroup>

		<h:panelGroup styleClass="card-text text-std" layout="block"
			rendered="#{not empty _item.card.text}">
			<h:outputText value="#{_item.card.text}" escape="false" converter="#{cardTextConverter}" />
		</h:panelGroup>

		<h:panelGroup styleClass="card-text text-std" layout="block"
			rendered="#{cardSearchCtrl.showCorrections and not empty _item.card.faqText}">
			<h:outputText value="[FAQ v#{_item.card.faqVersion}] #{_item.card.faqText}" escape="false"
				converter="#{cardTextConverter}" styleClass="error-text" />
		</h:panelGroup>

		<h:panelGroup styleClass="card-footer text-small" layout="block">
			<p:commandLink value="#{_item.card.crstName}"
				action="#{cardSearchCtrl.searchWithCardSet(_item.card.crstId)}" styleClass="search-link"
				update=":searchForm:searchBox :searchResults" process="@this" title="#{msgs.set}" />
			<!-- <h:outputText value="#{_item.card.crstName}" title="#{msgs.set}" /> -->
			<h:outputText value="&nbsp;-&nbsp;" />

			<ui:fragment rendered="#{not empty _item.card.enstName}">
				<p:commandLink value="#{_item.card.enstName}"
					action="#{cardSearchCtrl.searchWithEncounterSet(_item.card.enstId)}" styleClass="search-link"
					update=":searchForm:searchBox :searchResults" process="@this" title="#{msgs.encounterSet}" />
				<!-- <h:outputText value="#{_item.card.enstName}" title="#{msgs.encounterSet}" /> -->
				<h:outputText value="&nbsp;-&nbsp;" />
			</ui:fragment>

			<ui:fragment rendered="#{not empty _item.card.sphereDisplay}">
				<p:commandLink value="#{_item.card.sphereDisplay}"
					action="#{cardSearchCtrl.searchWithSphere(_item.card.sphereCode)}" styleClass="search-link"
					update=":searchForm:searchBox :searchResults" process="@this" title="#{msgs.sphere}" />
				<!-- <h:outputText value="#{_item.card.sphereDisplay}" title="#{msgs.sphere}" /> -->
				<h:outputText value="&nbsp;-&nbsp;" />
			</ui:fragment>

			<!-- <h:outputText value="&nbsp;-&nbsp;" /> -->
			<h:outputText value="#{_item.card.quantity}x" title="#{msgs.quantity}" />
			<h:outputText value="&nbsp;" />
			<h:outputText value="#{_item.card.number}" style="font-weight: bold;" title="#{msgs.number}" />
			<h:outputText value="#{msgs.missing}" title="#{msgs.missingInfo}"
				rendered="#{not _item.card.localized}" style="float: right; font-weight: bold;" />
		</h:panelGroup>

	</h:panelGroup>

</ui:composition>